<html>
<head>
<script "text/javascript", src="http://dev.internet-wifi.com.ar/net/js/dojo/dojo/dojo.js", djConfig="parseOnLoad:true, isDebug: true"></script>
<script "text/javascript", src="http://dev.internet-wifi.com.ar/net/js/dojo/dijit/dijit.js"></script>

</head>
<body>
<script type="text/javascript">
  dojo.require("dijit.form.Button");
  dojo.require("dojo.data.ItemFileReadStore");
  
  //Create a new data store
  var countryStore = new dojo.data.ItemFileReadStore({url: "http://dev.internet-wifi.com.ar/net/countries.json"});
  
  //This function writes the retrieved data to a DIV, and is attached
  //to the 'onComplete' event in the request object
  var gotContinents = function(items, request){
    var buffer = ["<b>Retrieved the following data</b>"];
      for (var i = 0; i < items.length; i++){
         var item = items[i];
       buffer.push(countryStore.getLabel(item));
      }
    
    dojo.byId("dataOutput").innerHTML = buffer.join("<br/>");
  }
  
  //This query finds all items that have a 'type' attribute set to 'continent'
  var queryContinents = {type:"continent"};
  
  //This query finds all items that have a 'type' attribute set to 'country'
  var queryCountries = {type:"country"};
    
  //Fetch the data.
  var getData = function(query){
    countryStore.fetch({query: query, onComplete: gotContinents});  
  };

</script>

<button dojoType="dijit.form.Button" onclick="getData(queryContinents);">Find all continents</button>
<button dojoType="dijit.form.Button" onclick="getData(queryCountries);">Find all countries</button>
<br/><br/>
<div id="dataOutput">
  The retrieved data is written here
</div>
</body>
</html>